package com.hxd.otc.module.fiat_deal.presenter;

import com.hxd.otc.R;
import com.hxd.otc.common.enums.BankType;
import com.hxd.otc.module.fiat_deal.bean.BaseFilterBean;
import com.hxd.otc.module.fiat_deal.bean.FilterBankTypeBean;
import com.hxd.otc.module.fiat_deal.bean.FilterFiatBean;
import com.hxd.otc.module.fiat_deal.contract.DealFilterDialogContract;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.utils.ResourceUtil;

import java.util.ArrayList;

/**
 * Created by lzy on 2018/12/25 0025.
 * description ${交易筛选条件 Prsenter}
 */
public class DealFilterDialogPresenter extends BasePresenter<DealFilterDialogContract.IView> implements DealFilterDialogContract.IPresenter {

    private String mFiat;
    private String mCurBankTypeValue;
    private ArrayList<BaseFilterBean> mFiats = new ArrayList<>();
    private ArrayList<BaseFilterBean> mBankTypes;

    public DealFilterDialogPresenter(DealFilterDialogContract.IView iView) {
        super(iView);
    }

    @Override
    public void setCurFiat(String fiat) {
        mFiat = fiat;
    }

    @Override
    public String getCurFiat() {
        return mFiat;
    }

    @Override
    public void setCurBankTypeValue(String curBankTypeValue) {
        mCurBankTypeValue = curBankTypeValue;
    }

    @Override
    public String getCurBankTypeValue() {
        return mCurBankTypeValue;
    }

    @Override
    public void setFiats(ArrayList<String> fiats) {
        mFiats.clear();
        if (fiats == null || fiats.size() == 0) return;
        for (String fiat : fiats) {
            mFiats.add(new FilterFiatBean(fiat));
        }
    }

    @Override
    public ArrayList<BaseFilterBean> getFiats() {
        return mFiats;
    }

    @Override
    public ArrayList<BaseFilterBean> getBankTypes() {
        if (mBankTypes == null) {
            mBankTypes = new ArrayList<>();
            mBankTypes.add(new FilterBankTypeBean(ResourceUtil.getString(R.string.all), ""));
            mBankTypes.add(new FilterBankTypeBean(BankType.WEXIN.getBankName(), BankType.WEXIN.getType() + ""));
            mBankTypes.add(new FilterBankTypeBean(BankType.ALIPAY.getBankName(), BankType.ALIPAY.getType() + ""));
            mBankTypes.add(new FilterBankTypeBean(BankType.BANK.getBankName(), BankType.BANK.getType() + ""));
        }
        return mBankTypes;
    }
}
